package day03.io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

/**
 * @ClassName OSWDemo
 * @Description TODO
 * @Author xinghaiyang
 * @Date 2023/3/20 13:38
 * @Version 1.0
 *
 * 字符转换流:字符流,高级流,只适合读写文本数据,作用是帮我们把字符转换为字节
 **/
public class OSWDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("osw.txt");
        //加上字符集,避免编解码的时候乱码
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("你好世界");
        System.out.println("写出完毕");
        osw.close();
    }
}
